import type { friendData, friend, SearchList } from '@/types/friend'
import { request } from '@/utils/request'
export const getGroupFriendList = () => {
  return request<friendData>('/getAddedFriend')
}
export const getSearchFriendList = (username: string) => {
  return request<friend[]>(`/searchFriend?username=${username}`)
}
export const createGroupFriend = (group_name: string, numberList: string[]) => {
  return request('/addGroup', 'post', { group_name, numberList })
}
export const getSearchUser = (username: string) => {
  return request<SearchList[]>(`/searchUser?username=${username}`)
}
export const sendFriendRequest = (
  friendId: string,
  friendName: string,
  avatar: string,
  nickname?: string
) => {
  return request('/sendFriendRequest', 'post', { friendId, friendName, avatar, nickname })
}
export const acceptFriendRequest = (friendId: string, friendName: string, avatar: string) => {
  return request('/acceptFriendRequest', 'post', { friendId, friendName, avatar })
}
export const getFriendUserInfo = (friendId: string) => {
  return request(`/getFriendInfo?friendId=${friendId}`)
}
export const deleteFriendUser = (friendId: string) => {
  return request(`/deleteFriend?friendId`, 'DELETE', { friendId })
}
export const getGroupInfo = (group_id: string) => {
  return request(`/getGroupInfo?group_id=${group_id}`)
}
export const deleteGroup = (group_id: string) => {
  return request(`/deleteGroup`, 'DELETE', { group_id })
}
